package com.jwds.digital.bios.business.api.controller.dispatch;

import com.jwds.digital.bios.business.core.infrastructure.dto.dispatch.DispatchLargeScaleEquipmentReqDTO;
import com.jwds.digital.bios.business.core.infrastructure.vo.dispatch.DispatchLargeScaleEquipmentRespVO;
import com.jwds.digital.bios.business.service.service.dispatch.IDispatchLargeScaleEquipmentService;
import com.jwds.tdc.framework.application.lib.BaseResponse;
import com.jwds.tdc.framework.application.lib.page.PageRequest;
import com.jwds.tdc.framework.application.lib.page.PageResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import java.util.List;
import javax.validation.Valid;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;

/**
 *  大机前端控制器
 *
 * @author 林柏云
 * @date 2024-12-23
 */
@Slf4j
@Api(tags = "大机--接口")
@RestController
@RequestMapping("/dispatch/large/scale/equipment")
public class DispatchLargeScaleEquipmentController {

  @Resource
  private IDispatchLargeScaleEquipmentService service;

  @GetMapping("/ById/{id}")
  @ApiOperation(value = "根据id查询")
  public BaseResponse<DispatchLargeScaleEquipmentRespVO> queryById(@PathVariable("id") Long id) {
    DispatchLargeScaleEquipmentRespVO respVo = service.queryById(id);
    return BaseResponse.success(respVo);
  }

  @PostMapping("/list")
  @ApiOperation(value = "分页查询")
  public BaseResponse<PageResponse<DispatchLargeScaleEquipmentRespVO>> page(@RequestBody PageRequest<DispatchLargeScaleEquipmentReqDTO> pageRequest) {
    PageResponse<DispatchLargeScaleEquipmentRespVO> respVoPage = service.page(pageRequest);
    return BaseResponse.success(respVoPage);
  }

  @PostMapping("/add")
  @ApiOperation(value = "新增")
  public BaseResponse<?> add(@RequestBody DispatchLargeScaleEquipmentReqDTO reqDto) {
    service.add(reqDto);
    return BaseResponse.success();
  }


  @PutMapping("/update")
  @ApiOperation(value = "更新对象")
  public BaseResponse<?> update(@RequestBody DispatchLargeScaleEquipmentReqDTO reqDto) {
    service.update(reqDto);
    return BaseResponse.success();
  }

  @DeleteMapping("/delete/{id}")
  @ApiOperation(value = "删除对象")
  public BaseResponse<?> delete(@PathVariable("id") Long id) {
    service.delete(id);
    return BaseResponse.success();
  }


}
